package com.tencent.sr.iris.basic.mp.service.activity;

import com.alibaba.fastjson.JSON;
import com.tencent.sr.iris.activity.interfaces.request.acticity.ActivityGiftPopupRequest;
import com.tencent.sr.iris.activity.interfaces.response.activity.ActivityGiftPopupResponse;
import com.tencent.sr.iris.basic.mp.dependency.activity.ActivityAwardDependency;
import com.tencent.sr.iris.basic.mp.interfaces.request.MpActivityGiftPopupRequest;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ActivityAwardService {

    @Resource
    private ActivityAwardDependency activityAwardDependency;

    /**
     * 活动权益弹窗
     * @param request
     * @return
     */
    public ActivityGiftPopupResponse popup(MpActivityGiftPopupRequest request) {
        log.info("ActivityAwardService.popup request:{}", JSON.toJSONString(request));
        ActivityGiftPopupRequest popupRequest = new ActivityGiftPopupRequest();
        BeanUtils.copyProperties(request,popupRequest);
        ActivityGiftPopupResponse popup = activityAwardDependency.popup(popupRequest);
        log.info("ActivityAwardService.popup response:{}", JSON.toJSONString(popup));
        return popup;
    }

    /**
     * 关闭权益弹窗
     * @param request
     * @return
     */
    public Boolean closePopup(MpActivityGiftPopupRequest request) {
        log.info("ActivityAwardService.closePopup request:{}", JSON.toJSONString(request));
        ActivityGiftPopupRequest popupRequest = new ActivityGiftPopupRequest();
        BeanUtils.copyProperties(request,popupRequest);
        Boolean result = activityAwardDependency.closePopup(popupRequest);
        log.info("ActivityAwardService.closePopup response:{}", result);
        return result;
    }
}
